import connectordemo.NameComparator;
import connectordemo.Student;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-07-07
 * Time: 13:53
 */
public class ComparatorTest {
    public static void main(String[] args) {
        Student[] student = new Student[4];
        student[0] = new Student(18, "wada");
        student[1] = new Student(17, "dawa");
        student[2] = new Student(16, "hhh");
        student[3] = new Student(15, "xxx");

        System.out.println("排序前" + Arrays.toString(student));


        NameComparator nameComparator = new NameComparator();
        Arrays.sort(student,nameComparator);

        System.out.println("排序后" + Arrays.toString(student));
    }
}
